from django.db import models
# from myutils.base_model import BaseModel
# Create your models here.

# 角色（普通用户）
class Role(models.Model):
    name = models.CharField(max_length=32)

    # 表名
    class Meta:
        db_table = 'role'

    def __str__(self):
        return self.name


# 用户
class User(models.Model):
    # 用户名
    uesr_name = models.CharField(max_length=255)
    # 用户密码
    password = models.CharField(max_length=255)
    # 手机号
    phone = models.CharField(max_length=11, null=True, blank=True)
    # 邮箱
    email = models.EmailField(max_length=30,null=True,blank=True)
    # 状态
    status = models.BooleanField(default=False)
    # 外键
    role = models.ForeignKey(Role, on_delete=models.CASCADE)

    class Meta:
        db_table = 'user'

    def __str__(self):
        return self.uesr_name


















